package wint.mvc.servlet.mock;

import java.util.Collections;
import java.util.Enumeration;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;

import wint.lang.magic.MagicMap;

public class ServletConfigMock implements ServletConfig {

	private MagicMap initParameters = MagicMap.newMagicMap();
	
	private ServletContextMock servletContextMock = new ServletContextMock();
	
	public ServletConfigMock(MagicMap initParameters) {
		super();
		this.initParameters = initParameters;
	}
	
	public ServletConfigMock() {
		super();
	}

	public String getInitParameter(String name) {
		return initParameters.getString(name);
	}

	public Enumeration<?> getInitParameterNames() {
		return Collections.enumeration(initParameters.keySet());
	}

	public ServletContext getServletContext() {
		return servletContextMock;
	}
	
	public void addParameter(String name, String value) {
		initParameters.put(name, value);
	}

	public String getServletName() {
		return "MockServlet";
	}

}
